const express = require('express');
const router = express.Router();
const userController = require('../controllers/userController');
const {isAdmin} = require("../middlewares/adminMiddleware");
const {authenticateToken} = require("../middlewares/authMiddleware");

router.get('/userinfo', authenticateToken, isAdmin, userController.getUser);
router.get('/usersearch', authenticateToken, isAdmin, userController.searchUser);
router.post('/useradd', userController.addUser);
router.delete('/userdelete/:id', authenticateToken, isAdmin, userController.deleteUser);
router.put('/useredit/:id', authenticateToken, isAdmin, userController.updateUser);
router.get('/usertotal', authenticateToken, isAdmin, userController.userNum);
router.post('/logintime', userController.loginTime);
router.get('/loginip', userController.loginIp);

module.exports = router;